package com.cy.pj.sys.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
/**
 * 基于此Dao,执行角色，菜单关系数据的操作
 * @author Administrator
 *
 */
public interface SysRoleMenuDao {

	//基于多个角色id获取对应的菜单id
	List<Integer> findMenuIdsByRoleIds(List<Integer> roleIds);
	
	//基于单个角色Id获取菜单Id
	@Select("select menu_id from sys_role_menus where role_id=#{roleId}")
	List<Integer> findMenuIdsByRoleId(Integer roleId);
	
	//保存角色和菜单的关系数据
	int insertObjects(Integer roleId,Integer[] menuIds);
	
	//基于角色Id删除角色和菜单的关系数据
	@Delete("delete from sys_role_menus where role_id=#{roleId}")
	int deleteObjectsByRoleId(Integer roleId);
	
	//基于菜单Id删除角色菜单关系数据
	@Delete("delete from sys_role_menus where menu_id=#{menuId}")
	int deleteObjectsByMenuId(Integer menuId);
}
